#include "dialoghistogram.h"

DialogHistogram::DialogHistogram(QWidget *parent) :
    QDialog(parent)
{
    ui.setupUi(this);
}

DialogHistogram::DialogHistogram(QWidget *parent, Image * image) :
    QDialog(parent)
{
    QWidget * tab;

    ui.setupUi(this);

    if(image->estGris)
    {
        tab = new HistogramTab(this,image->histogram[Image::gris],Image::gris, image->qImage.height() * image->qImage.width());
        ui.tabHistograms->addTab(tab,"gris");
    }
    else
    {
        tab = new HistogramTab(this,image->histogram[Image::rouge],Image::rouge, image->qImage.height() * image->qImage.width());
        ui.tabHistograms->addTab(tab,"Rouge");
        tab = new HistogramTab(this,image->histogram[Image::vert],Image::vert, image->qImage.height() * image->qImage.width());
        ui.tabHistograms->addTab(tab,"Vert");
        tab = new HistogramTab(this,image->histogram[Image::bleu],Image::bleu, image->qImage.height() * image->qImage.width());
        ui.tabHistograms->addTab(tab,"Bleu");
        tab = new HistogramTab(this,image->histogram[Image::gris],Image::gris, image->qImage.height() * image->qImage.width());
        ui.tabHistograms->addTab(tab,"Luminosite");
    }
}

DialogHistogram::~DialogHistogram()
{

}
